const express = require('express')

const router = express.Router()

router.get('/', (req, res,  next) => {
  console.log('req.query', req.query);
  console.log(1);
  res.send(req.query)
})

router.get('/index', (req, res,  next) => {
  console.log(2);
  console.log('req.query', req.query);
  res.send(req.query)
})

router.post('/index', (req, res,  next) => {
  console.log(2);
  console.log('req.query', req.query);
  console.log('req.body', req.body);
  res.send(`post：${JSON.stringify(req.body)}`)
})

router.put('/index', (req, res,  next) => {
  console.log(2);
  console.log('req.query', req.query);
  console.log('req.body', req.body);
  res.send(`put：${JSON.stringify(req.body)}`)
})

router.patch('/index', (req, res,  next) => {
  console.log(2);
  console.log('req.query', req.query);
  console.log('req.body', req.body);
  res.send(`patch：${JSON.stringify(req.body)}`)
})

router.delete('/index', (req, res,  next) => {
  console.log(2);
  console.log('req.query', req.query);
  console.log('req.body', req.body);
  res.send(`delete：${JSON.stringify(req.body)}`)
})

router.all('/index', (req, res,  next) => {
  console.log(2);
  console.log('req.query', req.query);
  console.log('req.body', req.body);
  res.send(`all：${JSON.stringify(req.body)}`)
})

module.exports = router
